// Copyright (c) 2025 Huawei Technologies Co., Ltd.
// openUBMC is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
//         http://license.coscl.org.cn/MulanPSL2
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
// See the Mulan PSL v2 for more details.
//
// Description: 实现kvm客户端认证提供删除会话的能力

#include "DeleteSession.hpp"

DeleteSession::DeleteSession(): ClientBaseHttp()
{
    ResetHttpCall();
}

DeleteSession::~DeleteSession() {}

void DeleteSession::GetReqBody(boost::string_view userName, const char* passWord)
{
    try {
        boost::json::object obj_body;
        obj_body["UserName"] = userName;
        obj_body["Password"] = passWord;
        boost::json::value json_body(obj_body);
        SetBody(boost::json::serialize(json_body).c_str());
    } catch (...) {
        throw;
    }
}

bool DeleteSession::DeleteSessionFromWeb(boost::string_view host, boost::string_view port, boost::string_view userName,
    const char* passWord)
{
    try {
        return ClientBaseHttp::Call(host, port, userName, passWord, boost::beast::http::verb::delete_);
    } catch (...) {
        throw;
    }
}
